package main

import (
	"github.com/kataras/iris/v12"
	"mongoDemo/common"
)

func (app *application) queryCourse(ctx iris.Context) {
	courseId := ctx.URLParam("courseId")
	user := ctx.URLParam("user")

	scores, err := app.mongo.QueryByCourseId(courseId, user)
	if err != nil {
		_ = ctx.JSON(common.Failed(err.Error()))
		return
	}
	_ = ctx.JSON(scores[0])
}
